import  random

r = random.randint(1,10)
i = 0
print(r)
while True:
    num = input('请猜数字')
    i = i + 1
    num = int(num)
    if int(num) < r:
        print('谜底比你猜的数字要大')
    elif int(num) > r:
        print('谜底比你猜的数字要小')
    else:
        print('猜中了')
        break
    print('这是第',i ,'次答题')
